package internal

import "dlist/global"

type Manager struct {
}

func (m *Manager) Get(key string) string {
	var setting Setting
	global.DB.Select("Value").Where("key=?", key).First(&setting)
	return setting.Value
}

func (m *Manager) Set(key string, value string) {
	setting := Setting{
		Key:   key,
		Value: value,
	}
	global.DB.Select("Key", "Value", "UpdatedAt").Where("key=?", key).Save(&setting)
}
